
import React from 'react'
import error from 'assets/images/error.png'
import succeed from 'assets/images/succeed.png'

export  class Aletts extends React.Component {

	constructor(props){
		super(props)
		this.state={
			show:this.props.data,
		}
	}
	
	componentDidmount(){
		setTimeout(()=>document.querySelector('#message').style="none",5000);
	}
	
	componentWillReceiveProps(nextProps){
		if(this.state.show !== nextProps.data){
			this.setState({show:nextProps.data});
		}
	}

	render(){
		return(
			<div className="messageAlert">
				<div className="Alert1">
					<img src={error} />
					<span>{this.state.show.message}</span>
				</div>
			</div>
		)
	}
	
	componentWillUnmount(){
		console.log('完蛋')
	}
}
